﻿using Sustainalytics.Entities;
using Sustainalytics.Entities.RiskRatings;
using System;
using System.Collections.Generic;

namespace Sustainalytics.RiskRatings.Reporting
{
    public class EventIndicatorPerformance
    {
        public int AnswerCategory { get; set; }
        public string Name { get; set; }
    }

    public class MaterialIssuePerformance
    {
        public RiskRatingClusterAssessment Assessment { get; set; }
        public double AvgExposure { get; set; }
        public double AvgManagedRisk { get; set; }
        public double AvgUnmanagedRisk { get; set; }
        public Guid CompanyId { get; set; }
        public List<EventIndicatorPerformance> EventIndicators { get; set; }
        public double Exposure { get; set; }
        public double ExcessExposure { get; set; }
        public double SubIndustryExposure { get; set; }
        public double Management { get; set; }
        public double ManageableRiskFactorPercentile { get; set; }
        public int ExternalId { get; set; }
        public double ManagedRisk { get; set; }
        public string Name { get; set; }
        public int Type { get; set; }
        public int SortKey { get; set; }
        public double UnmanagedRisk { get; set; }
        public double FinalWeight { get; set; }
    }

    public class ReportDataSource
    {
        public Guid CompanyId { get; set; }
        public ReportType ReportType { get; set; }
        public RiskRatingResearchProfile CompanyProfile { get; set; }
        public CoreRiskRatingResearchProfile CoreCompanyProfile { get; set; }
        public RiskRatingBenchmark Benchmark { get; set; }
        public byte[] Glossary { get; set; }
        public List<RiskRatingCluster> MaterialIssuesClusters { get; set; }
        public List<MeiDescription> MEIDescriptions { get; set; }
        public List<ExposureCluster> ExposureClusters { get; set; }
        public List<ManagementCluster> ManagementClusters { get; set; }
        public List<MaterialIssuePerformance> MaterialIssuesOverview { get; set; }
        public List<RiskRatingCluster> OverallClusters { get; set; }
        public IndustryAggregate IndustryAggregateDataPoints { get; set; }
        public SubIndustryAggregate SubIndustryAggregateDataPoints { get; set; }
        public Dictionary<int, UniverseMaterialEsgIssueAggregate> UniverseMEIAggregateDataPointsDictionary { get; set; }
        public Dictionary<int, IndustryMaterialEsgIssueAggregate> IndustryMEIAggregateDataPointsDictionary { get; set; }
        public Dictionary<int, SubIndustryMaterialEsgIssueAggregate> SubIndustryMEIAggregateDataPointsDictionary { get; set; }
        public Dictionary<int, List<SubIndustryRiskRatingPerformance>> SubIndustryMEIRiskRatingPerformanceDictionary { get; set; }
        public Dictionary<int, List<GlobalUniverseRiskRatingPerformance>> GlobalUniverseMEIRiskRatingPerformanceDictionary { get; set; }
        public Dictionary<int, SubIndustryMaterialEsgIssueAggregate> SubIndustryRiskRatingPerformanceDictionary { get; set; }
        public List<SubIndustryRiskRatingPerformance> SubIndustryRiskRatingPerformanceList { get; set; }
        public List<GlobalUniverseRiskRatingPerformance> GlobalUniverseRiskRatingPerformanceList { get; set; }
        public string SubIndustry { get; set; }
        public UniverseAggregate UniverseAggregateDataPoints { get; set; }
        public IEnumerable<EventIndicator> Events { get; set; }
        public IEnumerable<Incident> Incident { get; set; }
        public List<GovernancePillars> GovernancePillarsList { get; set; }

        public ReportDataSource Clone()
        {
            return new ReportDataSource()
            {
                CompanyId = CompanyId,
                ReportType = ReportType,
                CompanyProfile = CompanyProfile,
                CoreCompanyProfile = CoreCompanyProfile,
                Benchmark = Benchmark,
                //RelativePerformance = RelativePerformance,
                //SubPeerGroupComparison = SubPeerGroupComparison,
                MaterialIssuesClusters = MaterialIssuesClusters,
                MEIDescriptions= MEIDescriptions,
                ExposureClusters =ExposureClusters,
                ManagementClusters=ManagementClusters,
                MaterialIssuesOverview = MaterialIssuesOverview,
                OverallClusters = OverallClusters,
                IndustryAggregateDataPoints = IndustryAggregateDataPoints,
                SubIndustryAggregateDataPoints = SubIndustryAggregateDataPoints,
                UniverseAggregateDataPoints = UniverseAggregateDataPoints,
                SubIndustryRiskRatingPerformanceDictionary = SubIndustryRiskRatingPerformanceDictionary,
                SubIndustryRiskRatingPerformanceList = SubIndustryRiskRatingPerformanceList,
                GlobalUniverseRiskRatingPerformanceList= GlobalUniverseRiskRatingPerformanceList,
                SubIndustry=SubIndustry,
                Glossary = Glossary,
                GovernancePillarsList = GovernancePillarsList
            };
        }
    }

    public class RiskRatingCompanyPerformance
    {
        public RiskRatingClusterAssessment Assessment { get; set; }
        public Guid CompanyId { get; set; }
        public string CompanyName { get; set; }
        public int Exposure { get; set; }
        public bool IsBottomPerformer { get; set; }
        public bool IsTopPerformer { get; set; }
        public int ManagedRisk { get; set; }
        public int Rank { get; set; }
        public double Score { get; set; }
    }

    public class RiskRatingRelativePerformance
    {
        public RiskRatingCompanyPerformance BottomPerformer { get; set; }
        public Guid CompanyId { get; set; }

        public double MarketCapRangeFrom { get; set; }
        public double MarketCapRangeTo { get; set; }

        public RiskRatingCompanyPerformance[] PeersList { get; set; }
        public RiskRatingCompanyPerformance TopPerformer { get; set; }
    }

    public class SubIndustryRiskRatingPerformance
    {
        public RiskRatingClusterAssessment Cluster { get; set; }
        public Guid CompanyId { get; set; }
        public double Exposure { get; set; }
        public double ManagementRisk { get; set; }
        public int MEIId { get; set; }
        public int SubPeerGroupId { get; set; }
        public double UnmanagedRisk { get; set; }
    }

    public class GlobalUniverseRiskRatingPerformance
    {
        public RiskRatingClusterAssessment Cluster { get; set; }
        public Guid CompanyId { get; set; }
        public int MEIId { get; set; }
        public double Exposure { get; set; }
        public double ManagementRisk { get; set; }
 
    }
    public class SubPeerGroupPerformance
    {
        public int AvgExposure { get; set; }
        public int AvgManagedRisk { get; set; }
        public int AvgUnmanagedRisk { get; set; }
        public int MaxExposure { get; set; }
        public int MaxManagedRisk { get; set; }
        public int MaxUnmanagedRisk { get; set; }
        public int MinExposure { get; set; }
        public int MinManagedRisk { get; set; }
        public int MinUnmanagedRisk { get; set; }
        public string Name { get; set; }
    }
}